local skill = fk.CreateSkill {
  name = "#ling__shenxian_tu_skill",
  attached_equip = "ling__shenxian_tu",
  tags = { Skill.Compulsory },
}

skill:addEffect(fk.DamageInflicted, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and data.damageType ~= fk.NormalDamage and player:hasSkill(skill.name) and
        #player.room.logic:getActualDamageEvents(1, function(e)
          return e.data.to == player and e.data.damageType ~= fk.NormalDamage
        end) == 0
  end,
  on_use = function(self, event, target, player, data)
    data:changeDamage(-1)
  end,
})

skill:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and data.damageType ~= fk.NormalDamage and player:hasSkill(skill.name) and
        #player.room.logic:getActualDamageEvents(1, function(e)
          return e.data.from == player and e.data.damageType ~= fk.NormalDamage
        end) == 0
  end,
  on_use = function(self, event, target, player, data)
    data:changeDamage(1)
  end,
})

return skill
